/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;

import static java.awt.RenderingHints.*;

/**
 * <p>Project: javase - Img2
 * <p>Powered by webrx On 2021-12-09 14:48:56
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Img2 {
    public static void main(String[] args) throws Exception {
        var i = new BufferedImage(400, 400, 1);
        var g = i.createGraphics();
        g.setRenderingHint(KEY_TEXT_ANTIALIASING, VALUE_TEXT_ANTIALIAS_GASP);
        g.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON);
        g.setRenderingHint(KEY_STROKE_CONTROL, VALUE_STROKE_DEFAULT);
        g.setColor(Color.RED);
        g.setStroke(new BasicStroke(5));
        g.drawOval(50, 50, 100, 100);
        g.setColor(Color.YELLOW);
        var f = new Font("", Font.BOLD, 50);
        g.setFont(f);
        int x = 65;
        int y = 120;
        g.drawString("18", x, y);
        ImageIO.write(i, "png", new File("user.png"));
        Runtime run = Runtime.getRuntime();
        run.exec("cmd /k start user.png");
    }
}
